//
// Created by jerry on 2024/5/18.
//

#ifndef DS_EXP5_BINARY_TREE_H
#define DS_EXP5_BINARY_TREE_H

#include <stdio.h>
#include "stdlib.h"
#include "string.h"
#define MAXSIZE 0x100
#define MALLOC(pointer, type, size)                      \
    do                                                   \
    {                                                    \
        pointer = (type *)malloc((size) * sizeof(type)); \
        if (pointer == NULL)                             \
        {                                                \
            fprintf(stderr, "Malloc Error\n");           \
            exit(1);                                     \
        }                                                \
        memset(pointer, 0, (size) * sizeof(type));       \
    } while (0);

#define TElemtype int
// #define RECURSIVE

typedef int Status;
typedef struct BiTNode
{
    TElemtype data;
    struct BiTNode *left, *right;
} BiTNode;
typedef BiTNode *BiTree;
#ifndef Elemtype
#define Elemtype BiTNode *
#endif
BiTNode *initBinaryTreeNode(Elemtype data);
void PreOrderTraverse(BiTree tree, int reverse);
Status DestroyBiT(BiTree tree);

#endif // DS_EXP5_BINARY_TREE_H
